/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aviso.managedbeans;

import aviso.entity.GroupName;
import aviso.facade.GroupNameFacade;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ApplicationScoped;

/**
 *
 * @author avgusti
 */
@ManagedBean
@ApplicationScoped
public class GroupNameBean {
@EJB
GroupNameFacade groupNameFacade;
List<GroupName> groupNames;
GroupName admin,user,staff;
    /** Creates a new instance of GroupNameBean */
    public GroupNameBean() {
    }

    public List<GroupName> getGroupNames() {
        if(groupNames==null)
        {
            groupNames=groupNameFacade.findAll();
            for(GroupName gn:groupNames)
            {
                if(gn.getName().equals("admin")) admin=gn;
                if(gn.getName().equals("user")) user=gn;
                if(gn.getName().equals("staff")) staff=gn;
            }
        }
        return groupNames;
    }

    public void setGroupNames(List<GroupNameBean> groupNames) {
        //this.groupNames = groupNames;
    }

    public GroupName getAdmin() {
        return admin;
    }

    public void setAdmin(GroupName admin) {
        this.admin = admin;
    }

    public GroupName getStaff() {
        return staff;
    }

    public void setStaff(GroupName staff) {
        this.staff = staff;
    }

    public GroupName getUser() {
        return user;
    }

    public void setUser(GroupName user) {
        this.user = user;
    }
    
    
}
